//计算距离
function distanceWith(num) {
  if (num >= 1 && num < 999999999) {
    return '距您' + num + 'km'
  } else if (num > 0 && num < 1) {
    var distance = num * 1000
    distance = Math.round(distance * 100) / 100
    return '距您' + distance + 'm'
  } else if (num == 0) {
    return '距您0m'
  }
}
//计算已售数量单位转换
function soldQuantity(num) {
  if(num >= 10000 && num != ''){
      // num = Number((num / 10000).toString().match(/^\d+(?:\.\d{0,1})?/)) + '万+'
      num = (num / 10000).toString().match(/^\d+(?:\.\d{0,1})?/) + '万+'
  }
  return num
}
module.exports = {
  distanceWith: distanceWith,
  soldQuantity: soldQuantity,
};